package org.thomias.exo1.multithread;
import java.util.Random;

public class TestMt {
	public static void main(String[] args) {
		Runnable r = new Runnable() {

			public void run() {
				try {
					for (int i = 0; i < 10; i++) {
						double d = new Random().nextDouble();
						int r = (int) (1000 * d);
						Thread.sleep(r);
						System.out.println(Thread.currentThread().getName()
								+ ": i=" + i);
					}
				} catch (Exception e) {
				}
			}
		};

		for (int i = 0; i < 10; i++) {
			Thread t = new Thread(r);
			t.setName("t" + i);
			t.start();
		}

	}
}
